package com.etone.thread.ThreadLocal;

public class ThreadLocaTest {

	private static 	ThreadLocal<StringBuilder> TL = new ThreadLocal<StringBuilder>();
	
	public static void main(String[] args) {
	
		StringBuilder sb = new StringBuilder();
		
		Thread a = new Thread(new ThreadA(sb));
		a.start();
		
		Thread b = new Thread(new ThreadA(sb));
		b.start();
		
		Thread c = new Thread(new ThreadA(sb));
		c.start();
		
	}
	
	
	
	static class ThreadA implements Runnable{

		StringBuilder sb = new StringBuilder();
		public ThreadA(StringBuilder sb){
			this.sb = sb;
			sb.append("_O");

		}
		
		@Override
		public void run() {
//			this.sb.append(Thread.currentThread().getName()+"_o");
			TL.set(this.sb);
			System.out.println(TL.get());
		}
		
	}
}
